 *******************
* Exporting representativeness table for Global South COVID paper
* 2020-09-22
* last updated: 2020-09-22
* Magdalena Larreboure
*******************

set more off
use "$da/GHA_reptable.dta" , clear

gl weight LSMS_WEIGHT
local demographics accra hhsize female finishedsecondary PPI_nat 

* Make Table

    gen var   = ""
    gen mean  = .
    gen wmean = .
    order var mean wmean
    global counter=1
    foreach v of varlist `demographics' {
        disp `v'
        replace var="`v'" in $counter
        qui sum `v'
        replace mean = `r(mean)' in $counter
        qui sum `v' [aw=$weight]
        replace wmean = `r(mean)' in $counter
        global counter=$counter + 1
    }
    keep if var != ""
    keep mean wmean
    format mean wmean %10.2fc

    export excel using "$dtab/Representativeness Table.xlsx", sheetmodify cell(C52)
